package com.jellyfishumbrella.GL;

import org.lwjgl.util.vector.Vector3f;

public class Normal extends Vector3d implements Cloneable{

	public Normal() {

	}

	public Normal(double x, double y, double z) {
		super(x, y, z);
	}
	
	public Normal clone(){
		Normal newNormal = new Normal();
		newNormal.x = x;
		newNormal.y = y;
		newNormal.z = z;
		return newNormal;
	}

	@Override
	public Vector3f toGL() {
		return new Vector3f((float) x, (float) y, (float) z);
	}

	public String toString() {
		return toGL().toString();
	}

	public void normalize() {
		double mag = Math.sqrt(x * x + y * y + z * z);
		if (mag != 0) {
			x /= mag;
			y /= mag;
			z /= mag;
		}
	}
}
